home *** CD-ROM | disk | FTP | other *** search
-
-
-
- Dlock(2) Jan. 8, 1993 Dlock(2)
-
-
- N✓NA✓AM✓ME✓E
- Dlock - lock or unlock a BIOS disk device
-
- S✓SY✓YN✓NO✓OP✓PS✓SI✓IS✓S
- LONG Dlock( WORD mode, WORD drv );
-
- D✓DE✓ES✓SC✓CR✓RI✓IP✓PT✓TI✓IO✓ON✓N
- _✓D_✓l_✓o_✓c_✓k is used to lock or unlock the BIOS device indicated
- by _✓d_✓r_✓v. No GEMDOS file operations are permitted on a
- locked drive. Thus, the _✓D_✓l_✓o_✓c_✓k call provides a mechanism
- for disk formatters or re-organizers to lock out other
- processes while low-level BIOS or XBIOS operations are in
- progress on the device.
-
- If bit 0 of _✓m_✓o_✓d_✓e is 1, the drive is locked; if it is _✓0
- then the drive is unlocked and may be used again by other
- programs. If a process terminates while holding a lock on
- a drive, that drive is automatically unlocked.
-
- Bit 1 of _✓m_✓o_✓d_✓e indicates what return values are desired. If
- this bit is 1, and if the drive is locked by a user pro-
- cess different from the caller, or if some process has
- files open on the drive, then that process' id will be
- returned (see below). This may be used to report a more
- useful error message to the user (by telling him or her
- which process is using the drive in question when a lock
- operation fails).
-
- All other bits of _✓m_✓o_✓d_✓e are reserved and must be set to 0.
-
- A lock operation followed immediately by an unlock is very
- similar to a media change, except that the lock operation
- will fail if there are open files that refer to the indi-
- cated drive.
-
-
- R✓RE✓ET✓TU✓UR✓RN✓NS✓S
- 0 if the lock/unlock operation was successful
-
- EDRIVE if _✓d_✓r_✓v is not a valid BIOS device number
-
- For a lock operation, the following error codes may be
- returned:
-
- A positive process id if bit 1 of _✓m_✓o_✓d_✓e is set, and the
- drive is already locked or in use by another user process.
-
- EACCDN if bit 1 of _✓m_✓o_✓d_✓e is clear and either open files
- exist on the drive or another process is searching a
- directory on the drive, or if bit 1 of _✓m_✓o_✓d_✓e is set and the
- drive is in use by the operating system.
-
- ELOCKED if bit 1 of _✓m_✓o_✓d_✓e is clear and another process has
- locked the drive, or if bit 1 of _✓m_✓o_✓d_✓e is set and the
-
-
-
- Version 0.99 MiNT Programmer's Manual 1
-
-
-
-
-
- Dlock(2) Jan. 8, 1993 Dlock(2)
-
-
- operating system has locked the drive.
-
- For an unlock operation the following error codes may be
- returned:
-
- ENSLOCK if _✓m_✓o_✓d_✓e is 0 and the drive was not locked by this
- process
-
- S✓SE✓EE✓E A✓AL✓LS✓SO✓O
- _✓F_✓x_✓a_✓t_✓t_✓r(2)
-
-
- N✓NO✓OT✓TE✓ES✓S
- Note that _✓D_✓l_✓o_✓c_✓k operates on BIOS devices, which may not
- always be in 1-1 correspondence with GEMDOS drive letters.
- For this reason, to lock GEMDOS drive A: (for example),
- the programmer should call _✓F_✓x_✓a_✓t_✓t_✓r on the root directory of
- A: ("A:\") and then use the _✓d_✓e_✓v field of the structure
- returned in order to determine the BIOS device correspond-
- ing to the GEMDOS drive.
-
-
- B✓BU✓UG✓GS✓S
- All GEMDOS operations are forbidden on a locked drive,
- even by the process that created the lock. It would be
- useful to have a mode which allowed the locking process
- (and only the locking process) to still make GEMDOS calls
- on the drive, but unfortunately the structure of the OS
- makes this difficult; there is also the above-mentioned
- difference between BIOS and GEMDOS devices to consider.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Version 0.99 MiNT Programmer's Manual 2
-
-
-